CentOS 7
Sponsored Link

OpenStack Liberty : How to use Manila
2015/12/05
 
How to use OpenStack Shared File System (Manila).
This example shows to install Shared File Systems on the existing environment like follows.
                                    |
+----------------------+            |            +-----------------------+
|   [ Control Node ]   |            |            |   [ Network Node ]    |
|       Keystone       |10.0.0.30   |   10.0.0.50|       DHCP Agent      |
|        Glance        |------------+------------|       L3 Agent        |
|       Nova API       |eth0        |        eth0|       L2 Agent        |
|    Neutron Server    |            |            |    Metadata Agent     |
|      Cinder API      |            |            |    Cinder Volume      |
|      Manila API      |            |            |                       |
+----------------------+            |            +-----------------------+
                                eth0|10.0.0.51
                        +----------------------+
                        |   [ Compute Node ]   |
                        |     Nova Compute     |
                        |       L2 Agent       |
                        |     Manila Share     |
                        +----------------------+

[1] Download official Manila service image and add it into Glance.
[root@dlp ~(keystone)]#
wget https://github.com/uglide/manila-image-elements/releases/download/0.1.0/manila-service-image.qcow2

[root@dlp ~(keystone)]#
glance image-create --name "manila-service-image" --file manila-service-image.qcow2 --disk-format qcow2 --container-format bare --visibility public

+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | 48a08e746cf0986e2bc32040a9183445     |
| container_format | bare                                 |
| created_at       | 2015-12-05T09:59:16Z                 |
| disk_format      | qcow2                                |
| id               | f9afb61c-a5a2-4b8c-b12d-9acefed34a47 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | manila-service-image                 |
| owner            | d625e02b3d394afbad250def2f88fefa     |
| protected        | False                                |
| size             | 306577408                            |
| status           | active                               |
| tags             | []                                   |
| updated_at       | 2015-12-05T09:59:20Z                 |
| virtual_size     | None                                 |
| visibility       | public                               |
+------------------+--------------------------------------+
[2] Create default share type.
[root@dlp ~(keystone)]#
manila type-create default_share_type True

+-----------+--------------------+------------+------------+-------------------------------------+-------------------------+
| ID        | Name               | Visibility | is_default | required_extra_specs                | optional_extra_specs    |
+-----------+--------------------+------------+------------+-------------------------------------+-------------------------+
| 95879d85- | default_share_type | public     | -          | driver_handles_share_servers : True | snapshot_support : True |
+-----------+--------------------+------------+------------+-------------------------------------+-------------------------+

[root@dlp ~(keystone)]#
manila type-list

+-----------+--------------------+------------+------------+-------------------------------------+-------------------------+
| ID        | Name               | Visibility | is_default | required_extra_specs                | optional_extra_specs    |
+-----------+--------------------+------------+------------+-------------------------------------+-------------------------+
| 95879d85- | default_share_type | public     | YES        | driver_handles_share_servers : True | snapshot_support : True |
+-----------+--------------------+------------+------------+-------------------------------------+-------------------------+
[3] Create share network.
[root@dlp ~(keystone)]#
neutron net-list

+--------------------------------------+---------+-------------------------------------------------------+
| id                                   | name    | subnets                                               |
+--------------------------------------+---------+-------------------------------------------------------+
| a499df4e-3892-4252-8f89-3e28ce786f58 | ext_net | 42a8be58-f4f9-4176-8fc8-e715621056e6 10.0.0.0/24      |
| aeba3fbe-fa14-4660-a7c9-f099a38eccb7 | int_net | 3ee9e9b7-5113-4ef7-ac99-eb21cbcc589c 192.168.100.0/24 |
+--------------------------------------+---------+-------------------------------------------------------+

[root@dlp ~(keystone)]#
INT_NET=$(neutron net-list | grep 'int_net' | awk '{print $2}')

[root@dlp ~(keystone)]#
INT_SUBNET=$(neutron net-list | grep 'int_net' | awk '{print $6}')
[root@dlp ~(keystone)]#
manila share-network-create --neutron-net-id $INT_NET --neutron-subnet-id $INT_SUBNET --name manila_share

+-------------------+--------------------------------------+
| Property          | Value                                |
+-------------------+--------------------------------------+
| name              | manila_share                         |
| segmentation_id   | None                                 |
| created_at        | 2015-12-05T09:52:50.077228           |
| neutron_subnet_id | 3ee9e9b7-5113-4ef7-ac99-eb21cbcc589c |
| updated_at        | None                                 |
| network_type      | None                                 |
| neutron_net_id    | aeba3fbe-fa14-4660-a7c9-f099a38eccb7 |
| ip_version        | None                                 |
| nova_net_id       | None                                 |
| cidr              | None                                 |
| project_id        | d625e02b3d394afbad250def2f88fefa     |
| id                | 5ed0d459-3598-4e9f-b094-74296d5c3a9a |
| description       | None                                 |
+-------------------+--------------------------------------+

[root@dlp ~(keystone)]#
manila share-network-list

+--------------------------------------+--------------+
| id                                   | name         |
+--------------------------------------+--------------+
| 5ed0d459-3598-4e9f-b094-74296d5c3a9a | manila_share |
+--------------------------------------+--------------+
[4] Create NFS share.
[root@dlp ~(keystone)]#
manila create NFS 1 --name share01 --share-network manila_share

+-----------------------------+--------------------------------------+
| Property                    | Value                                |
+-----------------------------+--------------------------------------+
| status                      | None                                 |
| share_type_name             | default_share_type                   |
| description                 | None                                 |
| availability_zone           | None                                 |
| share_network_id            | None                                 |
| export_locations            | []                                   |
| share_server_id             | None                                 |
| host                        | None                                 |
| snapshot_id                 | None                                 |
| is_public                   | False                                |
| task_state                  | None                                 |
| snapshot_support            | True                                 |
| id                          | 604d862e-3d94-4930-a9d7-9b821912491f |
| size                        | 1                                    |
| name                        | share01                              |
| share_type                  | 95879d85-2f8f-4b07-9e9c-d82b28fba359 |
| created_at                  | 2015-12-05T10:04:12.520206           |
| export_location             | None                                 |
| share_proto                 | NFS                                  |
| consistency_group_id        | None                                 |
| source_cgsnapshot_member_id | None                                 |
| project_id                  | d625e02b3d394afbad250def2f88fefa     |
| metadata                    | {}                                   |
+-----------------------------+--------------------------------------+

# few minutes later, the Status turns to available

[root@dlp ~(keystone)]#
manila list

+--------------------------------------+---------+------+-------------+-----------+-----------+--------------------------------------+
| ID                                   | Name    | Size | Share Proto | Status    | Is Public | Share Type                           |
+--------------------------------------+---------+------+-------------+-----------+-----------+--------------------------------------+
| 604d862e-3d94-4930-a9d7-9b821912491f | share01 | 1    | NFS         | available | False     | 95879d85-2f8f-4b07-9e9c-d82b28fba359 |
+--------------------------------------+---------+------+-------------+-----------+-----------+--------------------------------------+
+---------------------------------------------------------------+-----------------------------------------+-------------------+
| Export location                                               | Host                                    | Availability Zone |
+---------------------------------------------------------------+-----------------------------------------+-------------------+
| 10.254.0.3:/shares/share-368f94c9-9538-4329-a07a-706c8e2743b6 | node01.srv.world@backend01#backend01 | nova              |
+---------------------------------------------------------------+-----------------------------------------+-------------------+
[5] At this point, 10.254.0.0/16 network has been created which is specified in manila.conf on Compute Node, and it's possible to login to Manila service instance from Compute Node like follows.
[root@node01 ~]#
ip addr

.....
.....
12: tap69cfd8f1-6c: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
    link/ether fa:16:3e:82:42:aa brd ff:ff:ff:ff:ff:ff
    inet 10.254.0.4/28 brd 10.254.0.15 scope global tap69cfd8f1-6c
       valid_lft forever preferred_lft forever
    inet6 fe80::f816:3eff:fe82:42aa/64 scope link
       valid_lft forever preferred_lft forever
.....
.....

# login with a user and password which you specified in manila.conf

[root@node01 ~]#
ssh manila@10.254.0.3

The authenticity of host '10.254.0.3 (10.254.0.3)' can't be established.
ECDSA key fingerprint is cd:ed:df:30:17:05:03:b2:9a:45:74:9c:ca:c1:ae:c6.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.254.0.3' (ECDSA) to the list of known hosts.
manila@10.254.0.3's password:
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-53-generic i686)

 * Documentation:  https://help.ubuntu.com/
$
$
df -hT

Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/vda1      ext4      1.1G  689M  332M  68% /
none           tmpfs     4.0K     0  4.0K   0% /sys/fs/cgroup
udev           devtmpfs  999M  4.0K  999M   1% /dev
tmpfs          tmpfs     202M  484K  202M   1% /run
none           tmpfs     5.0M     0  5.0M   0% /run/lock
none           tmpfs    1008M     0 1008M   0% /run/shm
none           tmpfs     100M     0  100M   0% /run/user
/dev/vdb       ext4      976M  1.3M  908M   1% /shares/share-368f94c9-9538-4329-a07a-706c8e2743b6
[6] It's OK all, you can use Manila Shared filesystem from anInstance like follows.
# allow access rights first

[root@dlp ~(keystone)]#
manila access-allow share01 ip 192.168.100.0/24 --access-level rw

+--------------+--------------------------------------+
| Property     | Value                                |
+--------------+--------------------------------------+
| share_id     | 604d862e-3d94-4930-a9d7-9b821912491f |
| access_type  | ip                                   |
| access_to    | 192.168.100.0/24                     |
| access_level | rw                                   |
| state        | new                                  |
| id           | 9486b8fd-55d9-45e0-9648-0f3cfff52057 |
+--------------+--------------------------------------+

[root@dlp ~(keystone)]#
nova list

+-----------+----------+---------+------------+-------------+-----------------------------------+
| ID        | Name     | Status  | Task State | Power State | Networks                          |
+-----------+----------+---------+------------+-------------+-----------------------------------+
| 745ed5bc- | CentOS_7 | SHUTOFF | -          | Shutdown    | int_net=192.168.100.3, 10.0.0.201 |
+-----------+----------+---------+------------+-------------+-----------------------------------+

[root@dlp ~(keystone)]#
nova start CentOS_7

Request to start server CentOS_7 has been accepted.
[root@dlp ~(keystone)]#
ssh 10.0.0.201

root@10.0.0.201's password:
Last login: Thu Dec 3 21:04:36 2015 from 10.0.0.30
[root@host-192-168-100-3 ~]#
mount -t nfs 10.254.0.3:/shares/share-368f94c9-9538-4329-a07a-706c8e2743b6 /mnt

[root@host-192-168-100-3 ~]#
df -hT

Filesystem                                                    Type      Size  Used Avail Use% Mounted on
/dev/mapper/centos-root                                       xfs       8.5G  854M  7.7G  10% /
devtmpfs                                                      devtmpfs  992M     0  992M   0% /dev
tmpfs                                                         tmpfs    1001M     0 1001M   0% /dev/shm
tmpfs                                                         tmpfs    1001M  8.3M  993M   1% /run
tmpfs                                                         tmpfs    1001M     0 1001M   0% /sys/fs/cgroup
/dev/vda1                                                     xfs       497M  102M  396M  21% /boot
10.254.0.3:/shares/share-368f94c9-9538-4329-a07a-706c8e2743b6 nfs4      976M  1.3M  908M   1% /mnt
 
Tweet